package cn.antia.util;

import java.util.List;

/**
 * User: Jacob Xiao
 * Date: 2008-7-14
 * Time: 18:04:59
 */
public class StringUtil {

    public static String arrayToString(String[] sarray, String separator) {
        if (sarray == null || sarray.length < 1) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        int i = 0;
        for (String f : sarray) {
            if (i != 0) {
                sb.append(separator);
            } else {
                ++i;
            }
            sb.append(f);
        }
        return sb.toString();
    }
    public static String arrayToString(List<String> sarray, String separator) {
        if (sarray == null || sarray.size() < 1) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        int i = 0;
        for (String f : sarray) {
            if (i != 0) {
                sb.append(separator);
            } else {
                ++i;
            }
            sb.append(f);
        }
        return sb.toString();
    }
}
